package org.dandsoft.blackbox.knowledge;

import java.io.Serializable;

/**
 * User: dvilyuzhanin
 * Date: 13.01.2009 14:47:13
 */
public class Version implements Serializable {
    private static final long serialVersionUID = -7184400620884617781L;
    private int value;

    public Version(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    public String format() {
        return Version.format(this);
    }

    public static String format(Version version) {
        return Integer.toString(version.getValue());
    }

    public static Version parse(String str) {
        return new Version(Integer.parseInt(str));
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Version version = (Version) o;

        if (value != version.value) return false;

        return true;
    }

    public int hashCode() {
        return value;
    }


    public String toString() {
        return "Version{" +
               "value=" + value +
               '}';
    }
}
